package
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class CarButton extends Button
	{
		private var xposition:int=-1,yposition:int=-1;
		public var car:Car;
		private var carContainer:Sprite = new Sprite();
		public function CarButton(m:Sprite)
		{
			super(m);
			carContainer.x-=45;
			carContainer.y-=35;
			addChild(carContainer);
		}
		override protected function send(e:Event):void{
			menu.hide();
			if (car==null){return;}
			renderSprite.garageWindow.show(xposition,yposition);
			if (contains(car))
			removeChild(car);
		}
		public function giveCarPos(x:int,y:int,c:Sprite):void{
			carContainer.removeChildren();
			xposition=x;
			yposition=y;
			car=c as Car;
			carContainer.addChild(car);
		}
	}
}